<template>
  <div class="contianer">父级: {{ money }}</div>
  <button @click="money = 1000">发钱</button>
  <br />
  <Son :money="money" @chang-money="updataMoney" />
</template>

<script>
import { provide, ref } from 'vue'
import Son from './son.vue'
export default {
  name: 'father',
  components: {
    Son
  },
  setup(props) {
    const money = ref(100)
    provide('pmoney', money)
    const updataMoney = (newmoney) => {
      //  money 是一个响应式对象
      money.value = newmoney
    }
    return { money, updataMoney }
  }
}
</script>

<style lang="less" scoped>
</style>
